package com.roc.util.constant;

import org.apache.commons.lang3.StringUtils;

public enum PayStatus {
	
	SETTLE_HANG("0","挂起"),
	SETTLE_COMPLETED("1","结算完成"),
	SETTLE_WAIT("2","待出款"),
	SETTLE_HANDLE("3","出款中"),
	SETTLE_RG_HANDLE("4","人工处理"),
	SETTLE_PAY_SUCCESS("5","代付成功"),
	SETTLE_PAY_ERROR("6","代付失败"),
	SETTLE_PAY_EXPORT("7","已汇出"),
	SETTLE_PAY_ARRIVED("8","已到账");
	private String code;
	private String name;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	private PayStatus(String code, String name) {
		this.code = code;
		this.name = name;
	}
	
	public static PayStatus valueOfCode(String code) {
		if (StringUtils.isBlank(code)) {
			throw new IllegalArgumentException("PayStatus " + code
					+ " is blank");
		}
		for (PayStatus mt : values()) {
			if (mt.getCode().equals(code)) {
				return mt;
			}
		}
		throw new IllegalArgumentException("PayStatus " + code
				+ " is not exist");
	}
}
